package server.business.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import server.business.pojo.DispenseMethods;
import server.business.pojo.TransfusionApplicationInformation;
import server.business.service.DispenseMethodsService;
import server.business.utils.Result;

/**
 * 配血方法数据字典
 */
@Controller
@RequestMapping("/dispenseMethods")
public class DispenseMethodsController {
    @Autowired
    private DispenseMethodsService dispenseMethodsService;
    /**
     * 查询数据
     */
    @RequestMapping("/normal/queryDispenseMethods")
    @ResponseBody
    public Result queryDispenseMethods() {
        dispenseMethodsService.list();
        Result result = new Result();
        result.setData(dispenseMethodsService.list());
        return result;
    }
    /**
     * 根据配血方法找到对应的费用
     */
    @RequestMapping("/normal/getDispenseCost")
    @ResponseBody
    public Result getDispenseCost(String dispenseMethod) {
        DispenseMethods dispenseMethods=dispenseMethodsService.getOne(new QueryWrapper<DispenseMethods>().eq(
                "code", dispenseMethod));
        Result result = new Result();
        result.setData(dispenseMethods);
        return result;
    }
}
